# eric7.Utilities.ClassBrowsers.__init__

Package implementing class browsers for various languages.

Currently it offers class browser support for the following programming languages.

- CORBA IDL
- JavaScript
- ProtoBuf
- Python 3
- Ruby

### Global Attributes

ClassBrowserRegistry
PTL_SOURCE
PY_SOURCE
RB_SOURCE
UNKNOWN_SOURCE
__extensions

### Classes

None

### Functions

determineSourceType | Function to determine the type of a source file given its name.
find_module | Function to extend the Python module finding mechanism.
getClassBrowserModule | Function to import a class browser module.
getIcon | Function to get an icon name for the given file (only for class browsers provided via plugins).
isSupportedType | Function to check, if the given file extension indicates a supported file type.
readmodule | Function to read a source file and return a dictionary of classes, functions, modules, etc.
registerClassBrowser | Function to register a class browser type.
scan | Function to scan the given source text.
unregisterClassBrowser | Function to unregister a class browser type.

## determineSourceType

determineSourceType(name, isPyFile=False)

Function to determine the type of a source file given its name.

name (str)
  file name or module name
isPyFile (bool (optional))
  flag indicating a Python file (defaults to False)

Return:
  source file type

Return Type:
  int

Up

## find_module

find_module(name, path, isPyFile=False)

Function to extend the Python module finding mechanism.

This function searches for files in the given list of paths. If the file name doesn't have an extension or an extension of .py, the normal Python search implemented in the imp module is used. For all other supported files only the paths list is searched.

name (str)
  file name or module name to search for
path (list of str)
  search paths
isPyFile (bool)
  flag indicating a Python file

Return:
  tuple of the open file, pathname and description. Description is a tuple of file suffix, file mode and file type)

Return Type:
  tuple

Raises ImportError:
  The file or module wasn't found.

Up

## getClassBrowserModule

getClassBrowserModule(moduleType)

Function to import a class browser module.

moduleType (str)
  type of class browser to load

Return:
  reference to the imported class browser module

Return Type:
  module

Up

## getIcon

getIcon(filename)

Function to get an icon name for the given file (only for class browsers provided via plugins).

filename (str)
  name of the file

Return:
  icon name

Return Type:
  str

Up

## isSupportedType

isSupportedType(fileext)

Function to check, if the given file extension indicates a supported file type.

fileext (str)
  file extension

Return:
  flag indicating a supported file type

Return Type:
  bool

Up

## readmodule

readmodule(module, searchPath=None, isPyFile=False)

Function to read a source file and return a dictionary of classes, functions, modules, etc. .

The real work of parsing the source file is delegated to the individual file parsers.

module (str)
  name of the source file
searchPath (list of str)
  list of paths the file should be searched in
isPyFile (bool)
  flag indicating a Python file

Return:
  the resulting dictionary

Return Type:
  dict

Up

## registerClassBrowser

registerClassBrowser(name, readModuleFunc, scanFunc, iconFunc, extensions)

Function to register a class browser type.

name (str)
  name of the class browser
readModuleFunc (function)
  function to read and parse a file returning a dictionary with the parsing result
scanFunc (function)
  function to scan a given source text returning a dictionary with the parsing result
iconFunc (function)
  function returning an icon name for the supported files
extensions (list of str)
  list of associated file extensions

Raises KeyError:
  raised if the class browser to be registered is already

Up

## scan

scan(src, filename, module, isPyFile=False)

Function to scan the given source text.

src (str)
  source text to be scanned
filename (str)
  file name associated with the source text
module (str)
  module name associated with the source text
isPyFile (bool)
  flag indicating a Python file

Return:
  dictionary containing the extracted data

Return Type:
  dict

Up

## unregisterClassBrowser

unregisterClassBrowser(name)

Function to unregister a class browser type.

name (str)
  name of the class browser

Up